package com.zb.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.entity.ZjRepairSet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/26 0026
 **/
@Data
@ApiModel("返厂设置实体封装")
public class RepairSetVo {

    @NotNull(message = "返厂ID不能为空")
    @ApiModelProperty(value = "返厂ID, 必传", required = true, example = "")
    private Long id;

    @NotNull(message = "是否自动审核返厂申请选项不能为空")
    @ApiModelProperty(value = "是否自动审核返厂申请：false-否(人工审核)，true-是(自动审核)", required = true, example = "false")
    private Boolean autoCheckRepairApply;

    @ApiModelProperty(value = "返厂地址库表ID", example = "0")
    private Long repairAddrStoreId;

    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createTime;

    @ApiModelProperty(value = "更新时间", hidden = true)
    private Date updateTime;

    public static RepairSetVo beanToVo(ZjRepairSet repairSet) {
        RepairSetVo vo = new RepairSetVo();
        BeanUtils.copyProperties(repairSet, vo);
        vo.setCreateTime(repairSet.getGmtCreate());
        vo.setUpdateTime(repairSet.getGmtUpdate());
        return vo;
    }

    public static ZjRepairSet voTobean(RepairSetVo vo) {
        ZjRepairSet repairSet = new ZjRepairSet();
        BeanUtils.copyProperties(vo, repairSet);
        return repairSet;
    }
}
